from flask import request,g
from blinker import Namespace

space = Namespace()
login_space = space.signal('登录')

def login_signal(sender):
    ip = request.remote_addr
    info = f'{g.uname}:{ip}'
    with open('login.log','a',encoding='utf-8') as f:
        f.write(info+'\n')


login_space.connect(login_signal)